---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: access-to-registry-packages-proxy
  namespace: d8-cloud-instance-manager
  {{- include "helm_lib_module_labels" (list . (dict "app" "registry-packages-proxy")) | nindent 2 }}
rules:
- apiGroups: ["apps"]
  resources: ["deployments/prometheus-metrics"]
  resourceNames: ["registry-packages-proxy"]
  verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: access-to-registry-packages-proxy
  namespace: d8-cloud-instance-manager
  {{- include "helm_lib_module_labels" (list . (dict "app" "registry-packages-proxy")) | nindent 2 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: access-to-registry-packages-proxy
subjects:
- kind: User
  name: d8-monitoring:scraper
- kind: ServiceAccount
  name: prometheus
  namespace: d8-monitoring
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: access-to-registry-packages-proxy-from-http
  namespace: d8-cloud-instance-manager
  {{- include "helm_lib_module_labels" (list . (dict "app" "registry-packages-proxy")) | nindent 2 }}
rules:
  - apiGroups: ["apps"]
    resources:
      - "deployments/http"
    resourceNames: ["registry-packages-proxy"]
    verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: access-to-registry-packages-proxy-from-http
  namespace: d8-cloud-instance-manager
  {{- include "helm_lib_module_labels" (list . (dict "app" "registry-packages-proxy")) | nindent 2 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: access-to-registry-packages-proxy-from-http
subjects:
- kind: ServiceAccount
  name: registry-packages-proxy
  namespace: d8-cloud-instance-manager
